package com.xiaoy.core.side.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.xiaoy.core.side.IdEntity;

@Entity
@Table(name = "test_side")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name="TEST_SIDE_SEQ",sequenceName="TEST_SIDE_SEQ",allocationSize=1)
public class Side extends IdEntity{
	private Long id;
	private String name;
	private SideType sideType;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TEST_SIDE_SEQ")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sideTypeId")
	public SideType getSideType() {
		return sideType;
	}

	public void setSideType(SideType sideType) {
		this.sideType = sideType;
	}
	
}
